package com.ktjy.ktmall.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ktjy.common.annotation.Excel;
import com.ktjy.common.core.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.util.Date;

/**
 * 微信小程序端的会员对象 t_wx_user
 *
 * @author ktjy
 * @date 2025-01-13
 */
@Data
@TableName("t_wx_user")
public class WxUser extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 会员编号
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 会员名称
     */
    @Excel(name = "会员名称")
    @TableField(value = "username")
    private String username;

    /**
     * 密码
     */
    @TableField(value = "password")
    private String password;

    /**
     * 性别
     */
    @Excel(name = "性别")
    @TableField(value = "gender")
    private Long gender;

    /**
     * 生日
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "生日", width = 30, dateFormat = "yyyy-MM-dd")
    @TableField(value = "birthday")
    private Date birthday;

    /**
     * 最近一次登录时间
     */
    @Excel(name = "最近一次登录时间")
    @TableField(value = "last_login_time")
    private String lastLoginTime;

    /**
     * 最近一次登录IP地址
     */
    @TableField(value = "last_login_ip")
    private String lastLoginIp;

    /**
     * 会员等级
     */
    @Excel(name = "会员等级")
    @TableField(value = "user_level")
    private Long userLevel;

    /**
     * 会员昵称
     */
    @TableField(value = "nickname")
    private String nickname;

    /**
     * 手机号码
     */
    @TableField(value = "mobile")
    private String mobile;

    /**
     * 会员头像
     */
    @TableField(value = "avatar")
    private String avatar;

    /**
     * 微信登录openid
     */
    @TableField(value = "open_id")
    private String openId;

    /**
     * 微信登录会话KEY
     */
    @TableField(value = "session_key")
    private String sessionKey;

    /**
     * 状态
     */
    @Excel(name = "状态")
    @TableField(value = "enabled")
    private Long enabled;

    /**
     * 家庭住址
     */
    @TableField(value = "fullLocation")
    private String fullLocation;

    /**
     * 职业
     */
    @TableField(value = "profession")
    private String profession;


    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("username", getUsername())
                .append("password", getPassword())
                .append("gender", getGender())
                .append("birthday", getBirthday())
                .append("lastLoginTime", getLastLoginTime())
                .append("lastLoginIp", getLastLoginIp())
                .append("userLevel", getUserLevel())
                .append("nickname", getNickname())
                .append("mobile", getMobile())
                .append("avatar", getAvatar())
                .append("openId", getOpenId())
                .append("sessionKey", getSessionKey())
                .append("enabled", getEnabled())
                .append("createTime", getCreateTime())
                .append("updateTime", getUpdateTime())
                .append("fullLocation", getFullLocation())
                .append("profession", getProfession())
                .append("createBy", getCreateBy())
                .append("updateBy", getUpdateBy())
                .append("remark", getRemark())
                .toString();
    }
}